import pymysql


dbhost = 'localhost'
dbuser = 'root'
dbpass = 'ywh.2004430'
dbname = 'test'
db = pymysql.connect(host=dbhost, user=dbuser, password=dbpass, database=dbname)
cursor = db.cursor()
sql = """INSERT INTO EMPLOYEE(FIRST_NAME,
LAST_NAME,AGE,SEX,INCOME)
VALUES('Mac','Su',20,'M',5000)"""
try:
    cursor.execute(sql)
    db.commit()
except:
    db.rollback()
db.close()